package com.hspedu.socket.MyTCPFileCopy;

import java.io.*;

/**
 * @author DL5O
 * @version 1.0
 */
public class StreamUtils {
    /**
     * 读取src 输入流中的数据，写入到 输出流中的对应文件里面去
     * @param src 源输入流
     * @param dst 目标输出流
     * @throws IOException
     */
    public static void outputFile(InputStream src, OutputStream dst) throws IOException {
        BufferedInputStream bi = new BufferedInputStream(src);
        byte [] buff = new byte[50];
        int readLen = 0;
        while((readLen = bi.read(buff) ) != -1){
            dst.write(buff,0,readLen);
        }
        dst.flush();
        System.out.println("写入成功");
    }
}
